package cn.broadsense.thrid.param;

import cn.broadsense.common.exception.ServiceException;
import cn.broadsense.thrid.result.VideoPlayResult;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 视频播放请求参数
 *
 * @author pengxin
 * @date 2022-08-08 17:06
 */
@ApiModel("视频播放请求参数")
@Data
public class VideoPlayParam<T> extends BaseParam {

    private static final long serialVersionUID = 5299407364920966267L;


    @ApiModelProperty(value = "资源类型 1 实时视频点播 2 历史视频回放 ", required = true)
    private String authorityType;

    @ApiModelProperty(value = "渠道编码", required = true)
    private String channelId;


    @ApiModelProperty(value = "回放开始时间（YYYYMMDDTHHmmssZ） 历史视频回放必填")
    private String beginTime;


    @ApiModelProperty(value = "回放结束时间（YYYYMMDDTHHmmssZ） 历史视频回放必填")
    private String endTime;

    @Override
    public void checkParam() {
        if (StrUtil.isBlank(authorityType) || StrUtil.isBlank(channelId)) {
            throw new ServiceException("渠道编码或者资源类型不能为空");
        }
    }

    @Override
    public Class getResultClass() {
        return VideoPlayResult.class;
    }

}
